package net.lab1024.sa.admin.module.business.erp.mmo.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.entity.MmordEntity;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.MmordAddForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.MmordQueryForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.MmordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.vo.MmordVO;
import net.lab1024.sa.admin.module.business.erp.mmo.service.MmordService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 工单 Controller
 *
 * @Author AKITA
 * @Date 2025-04-19 08:57:48
 * @Copyright AKITA
 */

@RestController
@Tag(name = "工单")
public class MmordController {

    @Resource
    private MmordService mmordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/mmord/queryPage")
    public ResponseDTO<PageResult<MmordVO>> queryPage(@RequestBody @Valid MmordQueryForm queryForm) {
        return ResponseDTO.ok(mmordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/mmord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid MmordAddForm addForm) {
        return mmordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/mmord/update")
    public ResponseDTO<String> update(@RequestBody @Valid MmordUpdateForm updateForm) {
        return mmordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/mmord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return mmordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/mmord/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return mmordService.delete(docEntry);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/mmord/info/{docEntry}")
    public ResponseDTO<MmordVO> info(@PathVariable Long docEntry) {
        return mmordService.info(docEntry);
    }

    @GetMapping("/mmord/myInfo")
    public ResponseDTO<MmordEntity> myInfo(@RequestParam("docEntry") Long docEntry, @RequestParam("userId") Long userId) {
        return mmordService.myInfo(docEntry,userId);
    }

    @GetMapping("/mmord/batchInsert")
    public ResponseDTO<MmordEntity> batchInsert(@RequestParam("docEntry") Long docEntry) {
        return mmordService.batchInsert(docEntry);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/mmord/onPlan/{id}")
    public ResponseDTO<MmordEntity> onPlan(@PathVariable Long id) {
        return mmordService.onPlan(id);
    }


    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/mmord/unOnPlay/{id}")
    public ResponseDTO<MmordEntity> unOnPlan(@PathVariable Long id) {
        return mmordService.unOnPlan(id);
    }




    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/mmord/infoUnexecute/{id}")
    public ResponseDTO<MmordVO> infoUnexecute(@PathVariable Long id) {
        return mmordService.infoUnexecute(id);

    }






}
